package com.xin.libhtmlcontent.tv.lib;

import android.util.Log;

import java.io.IOException;
import java.io.InputStream;

import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class NetWork {

    public static InputStream getInputStream(String urlString) {
        OkHttpClient okHttpClient = HttpUtils.getOkHttpClient();
        Call call = okHttpClient.newCall(new Request.Builder().url(urlString).build());
        try {
            Response response = call.execute();
            InputStream inputStream = response.body().byteStream();
            return inputStream;
        } catch (IOException e) {
            e.printStackTrace();
            Log.d("NetWork", "getInputStream() called with: urlString = [" + urlString + "]");
            return null;
        }
    }

}

